/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/15
\**********************/
#include "LuaListElement.h"

#define CObjPtr ((CListElementUI*)m_cobj)

namespace DuiLib {

int LuaListElement::GetIndex()
{
    return CObjPtr->GetIndex();
}

void LuaListElement::SetIndex(int iIndex)
{
    CObjPtr->SetIndex(iIndex);
}

int LuaListElement::GetOwner(LuaState *L)
{
    IListOwnerUI* ctrl = CObjPtr->GetOwner();
    LuaHelperNS::PushCObj(L, ctrl);
    return 1;
}

void LuaListElement::SetVisible(bool bVisible)
{
    CObjPtr->SetVisible(bVisible);
}

void LuaListElement::SetEnabled(bool bEnable)
{
    CObjPtr->SetEnabled(bEnable);
}

bool LuaListElement::IsSelected()
{
    return CObjPtr->IsSelected();
}

bool LuaListElement::Select(bool bSelect)
{
    return CObjPtr->Select(bSelect);
}

bool LuaListElement::SelectMulti(bool bSelect)
{
    return CObjPtr->SelectMulti(bSelect);
}

bool LuaListElement::IsExpanded()
{
    return CObjPtr->IsExpanded();
}

bool LuaListElement::Expand(bool bExpand)
{
    return CObjPtr->Expand(bExpand);
}

void LuaListElement::Invalidate()
{
    CObjPtr->Invalidate();
}

bool LuaListElement::Activate()
{
    return CObjPtr->Activate();
}

SDLUA_BEGIN_REGISTER(LuaListElement, ListElement, Control)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, GetIndex, GetIndex)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, SetIndex, SetIndex)
    SDLUA_REGISTER_FUN_LUA(LuaListElement, GetOwner, GetOwner)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, SetVisible, SetVisible)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, SetEnabled, SetEnabled)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, IsSelected, IsSelected)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, Select, Select)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, SelectMulti, SelectMulti)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, IsExpanded, IsExpanded)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, Expand, Expand)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, Invalidate, Invalidate)
    SDLUA_REGISTER_FUN_CPP(LuaListElement, Activate, Activate)
SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaListElement, ListElement)
SDLUA_END_UNREGISTER(ListElement)

}

#undef CObjPtr